:root {
    --editor-height: calc(100vh - var(--header-height) - 40px);
    --resource-panel-height: 290px;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: var(--editor-height);
    gap: 20px;
    margin: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    overflow: hidden;
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.editor-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: var(--primary-color);
    font-weight: 500;
}

.editor-actions {
    display: flex;
    gap: 12px;
}

.editor-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: var(--primary-color);
    font-weight: 500;
}

.editor-actions {
    display: flex;
    gap: 12px;
}

.preview-btn,
.save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    background: var(--secondary-color);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.preview-btn:hover,
.save-btn:hover {
    background: #2980b9;
}

.preview-btn svg,
.save-btn svg {
    width: 16px;
    height: 16px;
}

.editor-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 0 20px;
}

.editor-tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    background: none;
    color: #666;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.editor-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.editor-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: var(--background-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.text-editor {
    padding: 20px;
}

.text-field {
    margin-bottom: 20px;
}

.text-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.text-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.text-field input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.seo-editor {
    padding: 20px;
}

.seo-field {
    margin-bottom: 20px;
}

.seo-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.seo-field input,
.seo-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.seo-field textarea {
    min-height: 100px;
    resize: vertical;
}

.seo-field input:focus,
.seo-field textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.resource-alt-field {
    margin-top: 8px;
}

.resource-alt-field input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.resource-alt-field input:focus {
    border-color: var(--primary-color);
    outline: none;
}

#html-editor {
    width: 100%;
    height: 100%;
    border: none;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Menlo', monospace;
}

.ace-tomorrow-night-blue {
    background-color: #1e1e1e !important;
    color: #d4d4d4 !important;
}

.ace-tomorrow-night-blue .ace_gutter {
    background: #252526 !important;
    color: #858585 !important;
    border-right: 1px solid #404040 !important;
}

.ace-tomorrow-night-blue .ace_marker-layer .ace_selection {
    background: #264f78 !important;
}

.ace-tomorrow-night-blue .ace_cursor {
    color: #a6a6a6 !important;
}

.drag-marker {
    position: absolute;
    background: rgba(38, 79, 120, 0.3);
    border-left: 2px solid #569cd6;
    z-index: 20;
}

.copy-btn {
    transition: color 0.3s;
}

.resource-panel {
    height: var(--resource-panel-height);
    background: white;
    border-radius: 10px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.resource-header {
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.resource-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--primary-color);
    font-weight: 500;
}

.resource-actions {
    display: flex;
    gap: 12px;
}

.upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    background: var(--secondary-color);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #2980b9;
}

.upload-btn input[type="file"] {
    display: none;
}

.resource-content {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow: hidden;
}

.resource-list {
    display: flex;
    gap: 16px;
    min-width: 0;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 16px 20px 4px;
    -webkit-overflow-scrolling: touch;
}

.resource-item {
    position: relative;
    width: 160px;
    height: 160px;
    border: 2px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    cursor: move;
    flex: 0 0 auto;
    background: var(--background-color);
    transition: all 0.3s;
}

.resource-item:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.resource-preview {
    position: relative;
    width: 100%;
    height: 100%;
}

.resource-preview img,
.resource-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: white;
}

.resource-dimensions {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.resource-dimensions svg {
    opacity: 0.8;
}

.resource-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
}

.resource-name {
    display: block;
    font-size: 12px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Resource Actions - Header */
.resource-header .resource-actions {
    display: flex;
    gap: 12px;
}

/* Resource Actions - Item */
.resource-item .resource-actions {
    display: flex;
    gap: 4px;
    padding: 8px;
    justify-content: flex-end;
}

.resource-item .resource-actions button {
    padding: 4px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.resource-item .resource-actions button:hover {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.drag-over {
    border-color: var(--secondary-color) !important;
    background-color: var(--background-color) !important;
}

/* Upload Progress Styles */
.upload-progress-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 16px;
    z-index: 1000;
    width: 300px;
    max-width: 90%;
}

.upload-progress-item {
    margin-bottom: 12px;
}

.upload-progress-item:last-child {
    margin-bottom: 0;
}

.upload-file-name {
    display: block;
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 6px;
}

.upload-progress-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.upload-progress-bar::after {
    content: attr(data-progress);
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #666;
    font-weight: bold;
}

.upload-progress-fill {
    height: 100%;
    background: var(--secondary-color);
    width: 0;
    transition: width 0.3s ease;
    border-radius: 4px;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: var(--secondary-color);
    width: 0;
    transition: width 0.3s ease;
    border-radius: 4px;
    position: relative;
}

.upload-progress-percent {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-color);
    font-weight: bold;
}

::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Responsive Design */
@media (max-width: 768px) {
    .editor-container {
        margin: 10px;
        gap: 10px;
    }

    .editor-header,
    .resource-header {
        padding: 12px 16px;
    }

    .editor-content,
    .resource-content {
        padding: 12px;
    }

    .resource-item {
        width: 140px;
        height: 140px;
    }
}
